/*
 * @Author: wuzhen
 * @Date: 2020-01-15 10:26:22
 * @LastEditors: wuzhen
 * @LastEditTime: 2020-04-16 14:53:21
 * @Description: getters
 */
const getters = {
  jsessionId: state => state.chat.jsessionId,
  unf: state => state.chat.unf,
  screen: state => state.system.screen,
  local: state => state.system.local,
  online: state => state.system.online,
  isClearMsg: state => state.setting.isClearMsg,
  friends: state => state.chat.friends,
  groups: state => state.chat.groups,
  chatUsers: state => state.chat.chatUsers,
  getChatMsg: state => id => {
    if (id) {
      const chatMsg = state.chat.chatMsg.map(v => {
        if (v.msgtype === 1009) {
          v.isPlay = false;
        }
        return v;
      });
      return chatMsg.filter(v => v.id === id);
    } else {
      return [];
    }
  },
  chatMsg: state => state.chat.chatMsg,
  chatting: state => state.chat.chatting,
  onlineUserIds: state => state.chat.onlineUserIds,
  userInfo: state => state.chat.userInfo,
  input_httpSeqno: state => state.chat.input_httpSeqno
};

export default getters;
